<p class="Paragraph"><help:paragraphinfo state="U" number="2"/>Defines one or more statement blocks that you only want to execute if a given condition is True.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/>The <span class="T1">If...Then</span> statement executes program blocks depending on given conditions. When <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Basic encounters an <span class="T1">If</span> statement, the condition is tested. If the condition is True, all subsequent statements up to the next <span class="T1">Else</span> or <span class="T1">ElseIf</span> statement are executed. If the condition is False, and an <span class="T1">ElseIf</span> statement follows, <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Basic tests the next condition and executes the following statements if the condition is True. If False, the program continues either with the next <span class="T1">ElseIf</span> or <span class="T1">Else</span> <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>statement. Statements following <span class="T1">Else</span> are executed only if none of the previously tested conditions were True. After all conditions are evaluated, and the corresponding statements executed, the program continues with the statement following <span class="T1">EndIf</span>.</p>
<p class="TextInTable"><draw:image draw:name="Icon0" svg:desc="This icon marks text containing important information on data and system security." svg:pixelx="32" svg:pixely="32" svg:width="0.847cm" svg:height="0.847cm" xlink:href="65640" draw:filter-name="" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
<p class="TextInTable"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/>You can use <span class="T1">GoTo</span> and <span class="T1">GoSub</span> to jump out of an <span class="T1">If...Then</span> block, but not to jump into an <span class="T1">If...Then</span> structure.</p>
</span></th></tr></table>
<p class="Paragraph"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/>The following example enables you to enter the expiration date of a product, and determines if the expiration date has passed.</p>
<p class="PropText"><help:paragraphinfo state="U" number="21" xmlns:help="http://openoffice.org/2000/help"/>MsgBox "The expiration date has passed"</p>
<p class="PropText"><help:paragraphinfo state="U" number="23" xmlns:help="http://openoffice.org/2000/help"/>MsgBox "The expiration date has not yet passed"</p>